#######################################################################
#
#	CAL STATE CHAMELEON PLUGIN (LOCAL)
#	version 3.4
#
#	(c) 2009 California State University
#	By David Walker
#	dwalker@calstate.edu
#	
#	This library is free software; you can redistribute it and/or
#	modify it under the terms of the GNU Lesser General Public
#	License as published by the Free Software Foundation; either
#	version 2.1 of the License, or (at your option) any later version.
#
#	This library is distributed in the hope that it will be useful,
#	but WITHOUT ANY WARRANTY; without even the implied warranty of
#	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
#	Lesser General Public License for more details.
#
#	http://www.gnu.org/licenses/lgpl.txt
#
########################################################################

package Parsers::PlugIn::Chameleon_Local;

use strict;
use base qw(Parsers::PlugIn::Chameleon);

sub new
{
	my $class = shift;
	my $self = {};
	
	# Z39.50 SERVER INFORMATION
	# 
	# vendor:   (required) acceptable values include 'Innovative' or 'Endeavor'
	# adress:   (required) server address
	# port:     (required) the port the z39.50 server runs on
	# database: (required) name of the database to search
	# timeout:  (required) time in seconds after which the connection should time-out if delayed 
	#              response from catalog; don't set this too low or you will get false time-outs
	
	$self->{'vendor'} = "Innovative";
	$self->{'address'} = "opac.example.com";
	$self->{'port'} = "210";
	$self->{'database'} = "innopac";
	$self->{'timeout'} = "10";
	
	
	# HOLDINGS IN BIBLIOGRAPHIC RECORD
	#
	# Chameleon will look for journal holdings in any attached holding records by default.  If you
	# track holdings in the marc bibliographic record, however, indicate the specific fields here.
	# The plugin will look in BOTH the bib and attached holding records.
	#
	# bib_fields: (optional) Enter each field as a three digit marc tag number followed by an underscore, 
	#                 followed by a single subfield code letter or number -- e.g., 866_a. 
	#                 Separate multiple entries by a comma.
	
	$self->{'bib_fields'} = "866_a, 855_k";
	

	# HOLDINGS RUNS DELIMITERS
	#
	# Holdings are typically expressed as a series of 'runs', usually broken-up by missing issues.
	# For example: '1:1(1980)-10:12(1990), 14:1(1994)-'.  These runs are typically separated from
	# each other using a delimiter, in the above example a comma, and a character to separate the 
	# starting and ending points of the run, in the above example a dash.
	#
	# Sometimes you'll have more than one character delimitings runs, either to separate different 
	# locations or as a hold over from a previous scheme.  You can use 'delimiter_replace' below to 
	# tell chameleon to replace that older character with the new 'delimiter' character. 
	#
	# delimiter:         (required) the character used to delimit each holding run
	# delimiter_replace: (optional) alternative delimiter that should be replaced with the delimiter above
	# span:              (required) the character used to separate the start and end of a run
		
	$self->{'delimiter'} = ",";
	$self->{'delimiter_replace'} = "";
	$self->{'span'} = "-";
	
	
	# ROLLING HOLDINGS
	#
	# Some holdings statements include relative dates, or rolling holdings.  For example, 'Latest 2 years'
	# or 'Last 6 months'.  These need to be expressed here.
	# 
	# rolling_holdings: (optional)  Include rolling holding statements.
	# 
	#              Separate multiple entries with a comma. Entries are case in-sensitive.
	#
	#              Use the pound sign '#' as a wildcard for numbers.  Chameleon will assume that the pound sign 
	#              represents a number 1-3 digits in length.  In that way you can catch statements like 
	#              'Latest 2 years' and 'Latest 14 years' with the single entry 'Latest # years'.
	#
	#              Keep in mind that chameleon matches down to the year level.  Statements like 'latest edition' 
	#              are meaningless to the plugin since it doesn't know how frequently a periodical is published.  
	#              Likewise, chameleon will look to round a statement about months up to a whole year.
	
	$self->{'rolling_holdings'} = "Latest year, Latest # years, Latest month, Last # months";
	
	
	# FULL DATE TO YEAR
	#
	# Some libraries will include the full date with commas for frequently occuring titles, e.g., 'Jan 16, 1999'.  
	# The comma messes-up the run delimiters.  So if you have these, set this value to 1 otherwise leave as 0.  Libraries 
	# that have patterns like (1981-1990) should *not* set this to 1.
	
	$self->{'full_date_to_year'} = 0;

	# CIRCULATION AVAILABILITY
	#
	# For book and media requests, chameleon can check to see if the item is available for check-out
	# as a condition for returning true.  Endeavor catalogs will work without any additiona information.
	#
	# availability:  (optional) If you have an Innovative catalog, you can set this value to indicate the 
	#                status messages for available items.  Separate multiple values by a comma. The statuses
	#                are the _public_ display name, *not* the internal code.

	$self->{'availability'} = "NOT CHECKD OUT, LIB USE ONLY";
	
	# IGNORE LOCATION(S)
	#
	# This will cause Chameleon to ignore holdings from the specified locations -- designed primarily for 
	# when you have attached items records with 'Intenet' as a location, as with the Innovative ERM
	#
	# ignore_location:	(optional) For Innovative catalogs, set here the names of the locations you want to
	#			ignore.  Use the publically displayed named (e.g. 'Internet'), *not* an internal code.  
	#			Separate multiple entries with commas.
	
	$self->{'ignore_locations'} = "";

	# PRINT ONLY
	#
	# This instructs Chameleon to show a link for the catalog if it find _any_ holdings, without processing
	# those holdings first to see if the year matches.  Useful if you feel your holdings are too inconsistent
	# to be parsed, but want Chameleon to _not_ show for matches on e-journals in the catalog.
	#
	# print-only:		(optional) set to 1 if you want chameleon to _not_ process holdings statements
	
	$self->{'print-only'} = 0;

	# SHOW LINK FOR RECORDS WITH 856 ONLY
	#
	# Normal behavior for Chameleon is to ignore records that have no holdings _and_ an 856 field, 
	# since these are assumed to be records for electronic journals (which SFX should account for in its 
	# KB anyway).  But you can override that logic here to show the link to the catalog when chameleon finds
	# these records.
	#
	# show-with-856:	(optional) set to 1 to have chameleon show link to catalog if it find records with
	#			no holdings _and_ an 856

	$self->{'show-with-856'} = 0;


	# LOGGING
	#
	# Set this entry to any value in order to have chameleon log its debugging messages to the 
	# SFX Apache log files.  Good for debugging a live implementation.
	
	$self->{'log'} = "";


	# do not modify these values
	
	$self->{'debug'} = "";
	
	bless $self, $class;
	
	return $self;
}

1;